2d array - ds hackerrank solution in c